'use strict';

module.exports = app => {
  const { STRING, INTEGER, DECIMAL, TEXT } = app.Sequelize;

  const Food = app.model.define('food', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    name: { type: STRING(100), allowNull: false, comment: '美食名称' },
    price: { type: DECIMAL(10, 2), allowNull: false, comment: '价格' },
    description: { type: TEXT, comment: '美食描述' },
    image: { type: STRING(255), comment: '图片地址' },
    category: { type: STRING(50), comment: '分类' },
    status: { type: INTEGER, defaultValue: 1, comment: '状态：1-上架，0-下架' },
    sort: { type: INTEGER, defaultValue: 0, comment: '排序' }
  });

  return Food;
};
